programming4us
           
 
 
Windows

Windows Azure : Peeking Under the Hood with a Command Shell (part 2) - Running the Command Proxy

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
10/17/2010 4:57:39 PM

3. Running the Command Proxy

Build the package and deploy it to the cloud just like with any normal cloud service.Hit the public HTTP endpoint. Your browser should load the minimal UI built in the previous section. But the difference here is that any command now runs inside the virtual machine.

You now have the equivalent of a command line inside a virtual machine in Windows Azure. At this point, you can run any command that will work on Windows, and see its output. This can be a lifesaver when you are debugging an issue.

Let’s start by doing a simple directory listing. Type dir in the input text box and press Enter. You should see a listing similar to the following:

Volume in drive E has no label.
Volume Serial Number is 1695-ED26

Directory of E:\

09/11/2009 12:37 PM <DIR> bin
09/11/2009 12:33 PM 932 Default.aspx
09/11/2009 05:33 AM 1,048 e8364df2-0cea-4b1c-ad3f-df9446281643.csman
09/11/2009 12:43 PM 0 fde6446adf8d4566a4972d17a8085223.0.cssx.tag
09/11/2009 12:13 PM 7,913 Web.config
09/11/2009 05:33 AM 491 [Content_Types].xml
09/11/2009 12:37 PM <DIR> _rels
5 File(s) 10,384 bytes
2 Dir(s) 1,038,286,848 bytes free


This tells you a few things about how your application is deployed inside the virtual machine. As you can see, your .cspkg package is extracted into the root of the E:\ partition, and your application is run from there. You can also try looking at the other partitions on the virtual machine, but some partitions/directories are locked down by an access control list (ACL), so the actual data you can get at is quite limited.

Another interesting command to run to “poke” around the environment is set to see all the environment variables, as shown in the following code snippet. As you can see, this returns a large number of environment variables:

ALLUSERSPROFILE=D:\ProgramData
APPDATA=D:\Users\9bb5edca-9aa1-4337-8df4-6667534b68a2\AppData\Roaming
APP_POOL_ID={8ED53209-8C24-459B-A2E3-300449E9F4DF}
CommonProgramFiles=D:\Program Files\Common Files
CommonProgramFiles(x86)=D:\Program Files (x86)\Common Files
COMPUTERNAME=RD00155D30217E
ComSpec=D:\windows\system32\cmd.exe
Coverage=D:\ProgramData\coverage
DFSTRACINGON=FALSE
FP_NO_HOST_CHECK=NO
LOCALAPPDATA=D:\Users\9bb5edca-9aa1-4337-8df4-6667534b68a2\AppData\Local
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=AMD64 Family 16 Model 2 Stepping 3, AuthenticAMD
PROCESSOR_LEVEL=16
PROCESSOR_REVISION=0203
ProgramData=D:\ProgramData
ProgramFiles=D:\Program Files
ProgramFiles(x86)=D:\Program Files (x86)
PROMPT=$P$G
PUBLIC=D:\Users\Public
SystemDrive=D:
SystemRoot=D:\windows
USERDOMAIN=CIS
USERNAME=9bb5edca-9aa1-4337-8df4-6667534b68a2
USERPROFILE=D:\Users\9bb5edca-9aa1-4337-8df4-6667534b68a2
windir=D:\windows
RdRoleRoot=E:\
RoleRoot=E:
RdRoleId=fde6446adf8d4566a4972d17a8085223.WebRole1_IN_0
TEMP=C:\Resources\temp\fde6446adf8d4566a4972d17a8085223.WebRole1\RoleTemp
TMP=C:\Resources\temp\fde6446adf8d4566a4972d17a8085223.WebRole1\RoleTemp
PATH=D:\windows\system32;D:\windows;D:\windows\System32\Wbem;
D:\windows\System32\WindowsPowerShell\v1.0\;
D:\Packages\Runtime\WebRole1_IN_0\x64;D:\Packages\Runtime\WebRole1_IN_0\x86



Note: This listing changes often, so what you see will surely be different.

These variables let you glean several bits of interesting information. You can see that your code runs under username 9bb5edca-9aa1-4337-8df4-6667534b68a2CIS. You can see that there is a specially created TEMP folder to which the role actually has write access. You can also see that the code is running on an AMD 64-bit processor. under the domain

The two most useful groups of commands to use while you are debugging issues are those that let you inspect processes and the network. For the former, a useful built-in command is tasklist, which lets you view running processes, along with some basic statistics on all of them. It is handy for taking a quick look at your virtual machine and spotting a process that is leaking memory (a common scenario when spawning badly written native code processes).

Here’s the output from running tasklist on a virtual machine.  Remember that these are deep implementation details of the machine, and you should never depend on them. In fact, you’ll probably see a dramatically different set of processes from the ones you see in the following example:

Image Name                     PID     Session#    Mem Usage
========================= ======== =========== ============
System Idle Process 0 0 24 K
System 4 0 3,904 K
smss.exe 392 0 988 K
csrss.exe 456 0 4,612 K
csrss.exe 496 1 4,676 K
wininit.exe 504 0 4,732 K
winlogon.exe 532 1 5,592 K
services.exe 580 0 6,196 K
lsass.exe 592 0 11,044 K
lsm.exe 600 0 5,856 K
svchost.exe 776 0 6,704 K
svchost.exe 848 0 6,700 K
svchost.exe 944 0 19,348 K
svchost.exe 300 0 9,036 K
svchost.exe 412 0 6,900 K
svchost.exe 428 0 30,560 K
SLsvc.exe 436 0 11,720 K
svchost.exe 816 0 9,876 K
svchost.exe 644 0 13,088 K
vmicsvc.exe 1148 0 4,472 K
vmicsvc.exe 1168 0 4,640 K
BlobStorageProxy.exe 1196 0 5,016 K
osdiag.exe 1236 0 6,168 K
svchost.exe 1256 0 6,248 K
svchost.exe 1308 0 3,364 K
svchost.exe 1368 0 14,172 K
svchost.exe 1388 0 5,772 K
svchost.exe 1404 0 4,736 K
LogonUI.exe 1832 1 15,760 K
rdagent.exe 1756 0 15,796 K
msdtc.exe 2248 0 7,956 K
RDMonitorAgent.exe 2572 0 7,376 K
RdRoleHost.exe 1956 0 64,036 K
cmd.exe 2772 0 2,072 K
tasklist.exe 2112 0 5,540 K
WmiPrvSE.exe 1508 0 7,108 K


For networking-related troubleshooting, use the netstat command to see the current open ports on the machine. This can be useful for debugging when there is a conflict caused by a port already being in use. The reason you don’t see the familiar 80 and 443 ports is because external requests don’t directly flow to these role instances. Recall that all requests go to a load balancer, which then farms the request to the correct role instance. As a part of that process, these requests get mapped to a different port as well:

Active Connections

Proto Local Address Foreign Address State
TCP 10.113.114.77:16001 vlan424:34341 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:35601 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:36864 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:38124 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:39391 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:40651 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:41920 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:43180 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:33799 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:35066 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:36326 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:37589 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:38849 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:58243 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:59503 TIME_WAIT
TCP 10.113.114.77:16001 vlan424:60771 TIME_WAIT
TCP 10.113.114.77:20000 c-67-170-0-208:24712 CLOSE_WAIT
TCP 10.113.114.77:20000 c-67-170-0-208:24714 ESTABLISHED
TCP 10.113.114.77:52917 co1-bc1-sn52:microsoft-ds SYN_SENT
TCP 10.113.114.77:52918 co1-bc1-sn52:netbios-ssn SYN_SENT
Other -----------------
- Windows 7 : Using Any Search Engine from the Address Bar
- Windows 7 : Understanding Internet Explorer Advanced Options
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us